import axios from 'axios'
// import router from '../router/index.js'

axios.defaults.baseURL = 'http://127.0.0.1:18001/'
// 超时请求
axios.defaults.timeout = 1000000
// 响应拦截器即异常处理

const ajax = {
  get(url, param) {
    return new Promise((resolve, reject) => {
      axios({
        method: 'get',
        url,
        params: param
      }).then(res => {
        resolve(res)
      })
    })
  },
  post(url, param) {
    return new Promise((resolve, reject) => {
      axios({
        method: 'post',
        url,
        data: param
      }).then(res => {
        resolve(res)
      }).catch((res) => {
      })
    })
  }
}
export default ajax
